import time

print(time.asctime())
print(type(time.localtime()))


class BaseTime2(object):
    def __init__(self):
        self.timevalue = None

    def set_ime(self, timevalue):
        self.timevalue = timevalue
        return self

    def get_time(self):
        return self.timevalue


class StructTime(BaseTime2):

    def change_localtime(self, seconds=None):
        """
        seconds=None 当前时区时间
        否则  timestamp 时间戳转tuple或者struct_time 时间元组
        :param seconds:
        :return:
        """
        self.timevalue = time.localtime(seconds=seconds)
        return self

    def change_mtime(self, seconds=None):
        # utc时间
        self.timevalue = time.gmtime(seconds=seconds)
        return self

    def change_strptime(self, time_str, time_format):
        """
        str 按照格式转换成 struct_time
        :param time_str:
        :param time_format:
        :return:
        """
        self.timevalue = time.strptime(time_str, time_format)
        return self


class timestamp(BaseTime2):

    def change_timestamp(self) -> float:
        """
        获取时间戳
        """
        self.timevalue = time.time()
        return self
